#include<stdio.h>
#include<pthread.h>
#include<string.h>
#include<sys/types.h>
#include<unistd.h>
void printids(const char *);
void *thr_fn(void *);

pthread_t             ntid;

int main(int argc,char **argv)
{
	int                err;

	err = pthread_create(&ntid,NULL,thr_fn,NULL);
	if(err !=0 )
		printf("can't create thread\n");
	printids("main thread:");
	printf("ntid = %lu \n",ntid);
	sleep(1);
	return 0;
}

void printids(const char *s)
{
	pid_t               pid;
	pthread_t           tid;

	pid = getpid();
	tid = pthread_self();
	printf("%s pid %lu tid %lu (0x%lx)\n",s,(unsigned long)pid,(unsigned long)tid,(unsigned long)tid);
}

void *thr_fn(void *arg)
{
	printids("new thread:");
	return (void *)0;
}
